package com.baowenli.mapper;

import com.baowenli.pojo.CheckIn;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CheckInMapper {

    /**
     * 添加人员住房登记信息
     */
    @ResultMap("brandResultMap")
    @Insert("INSERT INTO check_in VALUES (null,#{orderid},#{roomId},#{roomNumber},#{pepCount},#{peoples},#{ids},now()," +
            "now(),now(),'1');")
    int insertPeopleHomeRegister(@Param("orderid") int orderId,@Param("roomId") int roomId,
         @Param("roomNumber") int roomNumber,@Param("pepCount") int pepCount,@Param("peoples") String peoples,
            @Param("ids") String ids);


    @ResultMap("brandResultMap")
    @Update("update check_in set check_out_time = now() where room_id = #{roomId} and order_id = #{orderId};")
    int exitHomeRegister(@Param("roomId") int roomId,@Param("orderId") int orderId);

    @ResultMap("brandResultMap")
    @Select("select * from check_in where room_id = #{roomId} and order_id = #{orderId}")
    CheckIn findHomeDateCount(@Param("roomId")int roomId,@Param("orderId")int orderID);

    @ResultMap("brandResultMap")
    @Select("select * from check_in where status = '1';")
    List<CheckIn> findAllEnterRoomInfo();
}
